import { IPSDataEntity } from '../dataentity/ipsdata-entity';
import { IPSDEDataSet } from '../dataentity/ds/ipsdedata-set';
import { IPSWFProcessSubWF } from './ipswfprocess-sub-wf';
import { IPSWFVersion } from './ipswfversion';
import { IPSWorkflow } from './ipsworkflow';
import { PSModelObjectImpl } from '../psmodel-object-impl';

export class PSWFProcessSubWFImpl extends PSModelObjectImpl implements IPSWFProcessSubWF {
  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected psdedataset: IPSDEDataSet | null = null;

  getPSDEDataSet(): IPSDEDataSet | null {
    if (this.psdedataset != null) return this.psdedataset;
    const value = this.M.getPSDEDataSet;
    if (value == null) {
      return null;
    }
    this.psdedataset = this.getPSModel4('dataentity.ds.IPSDEDataSet', value, 'getPSDEDataSet') as IPSDEDataSet;
    return this.psdedataset;
  }

  get psDEDataSet(): IPSDEDataSet | null {
    return this.getPSDEDataSet();
  }

  getPSDEDataSetMust(): IPSDEDataSet {
    const value = this.getPSDEDataSet();
    if (value == null) {
      throw new Error('未指定嵌套流程实体数据集');
    }
    return value;
  }

  protected psdataentity: IPSDataEntity | null = null;

  getPSDataEntity(): IPSDataEntity | null {
    if (this.psdataentity != null) return this.psdataentity;
    const value = this.M.getPSDataEntity;
    if (value == null) {
      return null;
    }
    this.psdataentity = this.getPSModel4('dataentity.IPSDataEntity', value, 'getPSDataEntity') as IPSDataEntity;
    return this.psdataentity;
  }

  get psDataEntity(): IPSDataEntity | null {
    return this.getPSDataEntity();
  }

  getPSDataEntityMust(): IPSDataEntity {
    const value = this.getPSDataEntity();
    if (value == null) {
      throw new Error('未指定嵌套流程实体');
    }
    return value;
  }

  protected pswfversion: IPSWFVersion | null = null;

  getPSWFVersion(): IPSWFVersion | null {
    if (this.pswfversion != null) return this.pswfversion;
    const value = this.M.getPSWFVersion;
    if (value == null) {
      return null;
    }
    this.pswfversion = this.getPSModel4('wf.IPSWFVersion', value, 'getPSWFVersion') as IPSWFVersion;
    return this.pswfversion;
  }

  get psWFVersion(): IPSWFVersion | null {
    return this.getPSWFVersion();
  }

  getPSWFVersionMust(): IPSWFVersion {
    const value = this.getPSWFVersion();
    if (value == null) {
      throw new Error('未指定嵌套流程版本');
    }
    return value;
  }

  protected psworkflow: IPSWorkflow | null = null;

  getPSWorkflow(): IPSWorkflow | null {
    if (this.psworkflow != null) return this.psworkflow;
    const value = this.M.getPSWorkflow;
    if (value == null) {
      return null;
    }
    this.psworkflow = this.getPSModel4('wf.IPSWorkflow', value, 'getPSWorkflow') as IPSWorkflow;
    return this.psworkflow;
  }

  get psWorkflow(): IPSWorkflow | null {
    return this.getPSWorkflow();
  }

  getPSWorkflowMust(): IPSWorkflow {
    const value = this.getPSWorkflow();
    if (value == null) {
      throw new Error('未指定嵌套流程');
    }
    return value;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get cls(): string {
    return 'PSWFProcessSubWFImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'wf.IPSWFProcessSubWF') return true;
    return super.instanceof(cls);
  }
}
